package com.zhangyu.shadow.core.delegate;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.disposables.Disposable;

/**
 * 提供了解绑操作
 *
 * @author zhangyu
 * @date 2017/12/7
 */

public abstract class RxShadowDelegate extends ShadowDelegate {
    protected List<Disposable> mDisposables = new ArrayList<>();

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        for (Disposable disposable : mDisposables) {
            if (disposable != null && !disposable.isDisposed()) {
                disposable.dispose();
            }
        }
        mDisposables = null;
    }
}
